package test1;


import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.authc.credential.PasswordService;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;

/**
 * @author:H.A
 * @Date:2019-04-07
 * @version:1.0
 *
 */
public class MyRealm5 extends AuthorizingRealm{

	private PasswordService passwordService;
	
	public void setPasswordService(PasswordService passwordService){
		this.passwordService= passwordService;
	}
	
	protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection){
		
		return null;
	}
	
	protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token)throws AuthenticationException{
		
		return new SimpleAuthenticationInfo("wu",passwordService.encryptPassword("123"),getName());
	}
}
